Panel Data
CommandPanels offers two types of data storage to help you build dynamic and responsive GUIs: Session Data and Panel Data. Understanding the difference between them allows for more control over how player interactions are stored and used between panels and commands.
Session Data
Session Data is temporary and exists only while a player is online. It persists between panels but is automatically cleared once the user logs off of the server.
Session data is great for:
- Passing input values between panels
- Creating dynamic workflows across multiple steps
- Storing short-lived user decisions or selections
This data is automatically handled for you whenever a player interacts with:
- Input fields in dialog panels
- Floodgate panels using form submissions
- Custom commands with arguments
- Temporary state changes
You can also use session data directly via Command Tags and placeholders.
Panel Data
Panel Data is persistent and saved to disk in a file called data.yml
. This file is stored in the plugin’s root directory, next to config.yml
and the panels/
folder.
Panel data is ideal for:
- Long-term tracking of user preferences
- Flags and toggles that must remain after restarts
- Progress tracking or persistent records
Because it’s permanent, this data remains available even after server restarts or player disconnects. Data should not be modified directly in the file unless the server is not running as changes will just get overwritten.
Include -s argument in the panel data command to silence output responses when performing operations.
Using Data in Panels
Both data types can be manipulated using Command Tags and Placeholders. These allow you to set, get, or delete values from session or panel data. Find the usages for both in the Command Tags and Placeholders Document pages.
Data Scope Summary
Feature | Session Data | Panel Data |
---|---|---|
Lifespan | Until player leaves the server | Until manually removed or overwritten |
Saved to Disk | No | Yes (data.yml ) |
Used For | Temporary Values | Permanent Values |
Automatically Set By | Inputs, Floodgate, Dialogs, or manually set | Must be manually set |